<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/quocha/lib/DanhMuc.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/quocha/lib/Sanpham.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/quocha/lib/User.php';
$danhmucOb = new DanhMuc();
$danhmucList = $danhmucOb->layDanhSachDanhMuc(DanhMuc::HIEN);
$sanphamOb = new Sanpham();
$user = new User();
$lienhe = $user->layLienHe(1);
if (isset($_POST['username']) && isset($_POST['password'])) {
    if ($user->kiemtradangnhapuser($_POST['username'], $_POST['password'])) {
        
    } else {
        header('Location: index.php');
    }
}
$spDacBietList = $sanphamOb->laySanPhamDacBiet();
?>

<div id="templatemo_content_wrapper">

    <div class="templatemo_sidebar_wrapper float_l">
        <div class="templatemo_sidebar_top"></div>
        <div class="templatemo_sidebar">

            <div class="sidebar_box">

                <h2>Danh Mục</h2>
                <div class="sidebar_box_content">

                    <ul class="categories_list">
                        <?php foreach ($danhmucList as $item): ?>
                            <li><a href="San-Pham-<?php echo $item['id'] ?>.html"><?php echo $item['tieude'] ?></a></li>
                        <?php endforeach; ?>
                    </ul>
                </div>
            </div>

            <div class="sidebar_box">
                <h2>Discounts</h2>
                <?php while ($sp = mysql_fetch_assoc($spDacBietList)): ?>
                    <div class="sidebar_box_content">
                        <a href="chitietsanpham.php?id=<?php echo $sp['id'] ?>" target="_parent"><img src="<?php echo $sp['hinhanh'] ?>" alt="product" width="160" height="120" /></a>
                        <p align="center" style="font-size: 12; color: #2A2522;"><strong><?php echo $sp['ten'] ?></strong></p>
                        <p class="price">
                            Giá:
                            <span style="color: #CF5902; nt-size: 14px;font-weight: bold;"><?php echo number_format($sp['gia']) ?> VNĐ</span>
                        </p>
                    <?php endwhile; ?>
                    <div class="cleaner"></div>
                </div>
            </div>
            

        </div> <div class="templatemo_sidebar_bottom"></div> <!-- end of sidebar -->
    </div> <!-- end of templatemo_sidebar_wrapper -->


